package com.javasvip.serviceemail.service.impl;

import com.javasvip.serviceemail.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class MailServiceImpl implements MailService {
    @Autowired
    private JavaMailSender mailSender;

    @Override
    public void sendMail(String user, String msg) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("jr-zywqd01@jybdshop.cn");
        message.setTo(user);
        message.setSubject("主题：验证码");
        message.setText(msg);

        mailSender.send(message);
    }
}
